//
//  WDSelectCell.m
//  Zhihuijinfu
//
//  Created by 王笛 on 2017/3/3.
//  Copyright © 2017年 王笛. All rights reserved.
//

#import "WDSelectCell.h"

@interface WDSelectCell ()
/** <#注释#> */
@property (nonatomic, strong) UILabel *payLabel;

@end

@implementation WDSelectCell

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        
        UILabel *label = [[UILabel alloc] init];
        label.layer.cornerRadius = 4;
        label.layer.masksToBounds = YES;
        label.textAlignment = NSTextAlignmentCenter;
        label.font = [UIFont systemFontOfSize:13];
        label.textColor = ColorForRGB(0x6b6b6b);
        label.layer.borderColor = ColorForRGB(0xf0f0f0).CGColor;
        label.layer.borderWidth = 1;
        label.adjustsFontSizeToFitWidth = YES;
        [self addSubview:label];
        self.payLabel = label;
        
        [label makeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(0);
        }];
    }
    return self;
}

-(void)UpdateCellWithState:(BOOL)select{
    
    _isSelected = select;
    
    self.payLabel.textColor = select ? ColorForRGB(0xfd5722) : ColorForRGB(0x6b6b6b);
    
    self.payLabel.layer.borderColor = select ? ColorForRGB(0xfd5722).CGColor : ColorForRGB(0xf0f0f0).CGColor;
    
}


//- (void)setSelected:(BOOL)selected
//{
//    [super setSelected:selected];
//    self.payLabel.textColor = selected ? ColorForRGB(0xfd5722) : ColorForRGB(0x6b6b6b);
//    self.payLabel.layer.borderColor =
//    selected ? ColorForRGB(0xfd5722).CGColor : ColorForRGB(0xf0f0f0).CGColor;
//}

- (void)setLabelStr:(NSString *)labelStr
{
    
    _labelStr = labelStr;
    self.payLabel.text = labelStr;
}

@end
